package com.w.learn;

import com.w.tank.GameObject;
import com.w.tank.TankFrame;

import java.awt.*;

public class RectDecorator extends Decorator{


    public RectDecorator(GameObject go){
        super(go);
    }
    @Override
    public void paint(Graphics g) {
        go.paint(g);
        x = go.x;
        y = go.y;
        if (x<0||y<0||x> TankFrame.GAME_WIDTH||y > TankFrame.GAMT_HEIGHT) {
            this.destory();
            return;
        }

        Color c = g.getColor();

        g.drawRect(x,y, go.getWidth(), go.getHeight());
        g.setColor(c);
    }


}
